1. Field of the Invention
The present invention relates to a method recognizing one-dimensional bar code or two-dimensional code, and more particularly, to a code type determining method detecting the presence/absence, the position, the type, etc. of one-dimensional/two-dimensional code from electronic image data where the one-dimensional/two-dimensional code is arranged along with a document or a graphic/chart, or from image data obtained by reading a paper sheet, on which the one-dimensional/two-dimensional code is arranged along with a document or a graphic/chart, with an image reading device such as a scanner, a CCD camera, etc., and to a code boundary detecting method accurately detecting a boundary of two-dimensional code.
2. Description of the Related Art
Conventionally, one-dimensional bar code is widely used. For the one-dimensional bar code, its bar code data can be recognized only if data by one line in the direction orthogonal to a black or white bar as a straight line which forms the code exists. To implement this, a device obtaining data by one line, such as a laser line scanner and a CCD line sensor is widely used as a reading device. Additionally, in recent years, two-dimensional code in which a lot more information than in such a one-dimensional bar code can be embedded has become widespread. The two-dimensional code cannot be properly recognized unless two-dimensional arrangement data of the entire code exists. Therefore, an image reading device such as a digital camera, an image scanner, etc. is used as a reading device. Also an image reading device that automatically recognizes both one-dimensional code and two-dimensional code has been commercialized as a single reading device.
Additionally, with the popularization of one dimensional/two-dimensional code, not only reading of code printed on a dedicated label up to now, but also printing of code of an arbitrary size in an arbitrary position along with a document or a graphic/chart is performed in many cases. If one-dimensional/two-dimensional code of an arbitrary size is arranged in an arbitrary position along with a document or a graphic/chart in this way, and if the code is read with a digital camera or an image scanner, there is a great possibility that part of the characters or the graphic/chart is also captured as image data in addition to the one-dimensional/two-dimensional code.
In such a case, the code cannot be properly recognized unless the position of the one-dimensional/two-dimensional code is detected, and only the range of the code is extracted. Additionally, since the recognition methods of the one-dimensional and the two-dimensional codes are totally different, recognition processes for both of the one-dimensional and two-dimensional codes are sequentially applied unless code existing in image data is proved to be either one-dimensional or two-dimensional code beforehand. As a result, a lot of time is required for the processing. Additionally, for the two-dimensional code, its recognition process cannot be executed unless the position of a boundary is properly identified, and the whole of a code region is extracted.
As described above, if a decoding process for two-dimensional code is executed for an entire image, for example, after a decoding process as a recognition process for one-dimensional code fails, the decoding process that is originally slow and heavy is executed twice. Furthermore, the decoding process for one-dimensional code is executed, for example, by supposing that the code exists in the horizontal direction of an obtained image. If the process fails, it must be again executed by supposing that the code exists in the vertical direction rotated by 90 degrees. This consumes a lot more time.
Japanese Patent Publication No. 2001-367014 “Two-dimensional Code Extracting Method” discloses a technique for obtaining the distribution of a black pixel ratio, etc. from a document including characters and other images, for detecting a block expected to be two-dimensional code, and for extracting as a two-dimensional code region a region where such blocks are successive.
Japanese Patent Publication No. 2000-200321 “Method Detecting the Position of Two-dimensional Bar Code and Reading the Two-dimensional Bar Code” discloses a technique for decoding information encoded in a digital manner in the form of two-dimensional bar code that does not include corner bits, has no boundary printed on a printing medium, and has no block.
Japanese Patent Publication No. HEI8-180125 “Two-dimensional Code Reading Device” and Japanese Patent Publication No. HEI7-254037 “Two-dimensional Code” disclose two-dimensional code whose reading accuracy is high, and its reading device, and use three positioning symbols in order to detect two-dimensional code. Japanese Patent Publication No. HEI8-180125 discloses a technique for detecting the positioning symbols in a hardware manner.
However, Japanese Patent Publication No. 2001-307014 and Japanese Patent Publication No. 2000-200321 target the reading of only two-dimensional code, and cannot detect, especially, one-dimensional code if the one-dimensional/two-dimensional code of an arbitrary size is arranged in an arbitrary position along with a document or a graphic/chart, etc.
Additionally, Japanese Patent Publication No. HEI8-180125 and Japanese Patent Publication No. HEI7-254037 detect the position or the region of code by detecting a positioning symbol included in two-dimensional code. With these methods, if the optical resolution of an input device is low, or if an optical distortion or out-of-focus occurs, this symbol cannot be detected because the shape of the positioning symbol within an image is deteriorated and deformed, and two-dimensional code cannot be accurately detected from the image data where a graphic/chart or characters are arranged.
FIG. 1 explains an example of a conventional code region extracting method using such positioning symbols. In two-dimensional code where positioning symbols exist in the upper left, the lower left, and the upper right of a code region as shown in this figure, the code region can be extracted by detecting these positioning symbols. However, for example, if an optical resolution is low, the positioning symbols cannot be detected.